﻿<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('已批示信件工单M')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            流水号：<input type="text" name="number"/>
                        </li>
                        <li>
                            来源：<input type="text" name="source"/>
                        </li>
                        <li>
                            信件状态：<select name="status">
                            <option value="">请选择</option>
                            <option value="1">未处理</option>
                            <option value="2">已处理</option>
                            <option value="3">已转发</option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/js/common/moment.min.js}"></script>
<script th:inline="javascript">
    $(function () {
        var options = {
            url: "/mail/nopsListJson.ajx?deptNo="+[[${deptNo}]],
            sortName: "id",
            sortOrder: "desc",
            uniqueId: "id",
            modalName: "待本部门回复",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                {field: 'swiftNumber', title: '流水号'},
                {field:'summary',title:'摘要'},
                {field:'authorName',title:'来信人'},
                {field:'address',title:'地址', formatter: function(value) { return value && value !== 'null' ? value : ''; }},
                {field:'source',title:'来源'},
                {field:'sentAt', title: '发送日期', formatter: function(value) {
                        return value && moment(value).isValid() ? moment(value).format('YYYY-MM-DD') : '';
                    }},
                {field:'instructAt',title:'日期', formatter: function(value) { return value && moment(value).isValid() ? moment(value).format('YYYY-MM-DD') : '';}},
                {field:'instructor',title:'批示人'},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showDetailWin('+row.id+')"><i class="fa"></i>详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function showDetailWin(ticketId){
        var url = "/mail/detail12345.do?ticketId="+ticketId;
        var title = '工单处理详情';
        var width = "80%";
        var height = "90%";
        var options = {
            url: url,
            title: title,
            width: width,
            height: height,
            btnArr: []
        }
        winDialog(options);
    }




    function fmtBackState(value,row,index) {
        var wfId = row.WfId;
        var fmunit = row.sbDept;
        var str = '';
        $.ajax({
            type: 'post',
            data: {wfId: wfId, sdeptId: fmunit},
            dataType: 'json',
            async: false,
            url: prefix + '/checkSendBack',
            success: function (result) {
                str = result.backDesc;
            }
        });
        return str;
    }
</script>
</body>
</html>